<?php
class Core_Data_Selectdata implements Core_Data_Mainable {
	
	/**
	 * database handler
	 * @var object $database
	 */
	public $database;
	
	/**
	 * constructor()
	 * database initialization
	 */
	public function __construct(){
		$this->database = new Core_Driver_Mysqlimproved;
	}
	
	/**
	 * @param array $variables
	 * @return array $data_array 
	 * @see Core_Data_Mainable::main()
	 */
	public function main(array $variables = null){
		$this->database->connect();
		$this->database->prepare($variables['query']);
		$this->database->query();
		$row = 0;
		while($data = $this->database->fetch('array')){
			$data_array[$row] = $data;
			$row++;
		}
		return $data_array;
	}
	
}